summon armor_stand ~ ~ ~ {Tags:[tempSS],Small:1b,Invisible:1b,Invulnerable:1b,Marker:1b}

item replace entity @n[tag=tempSS,type=armor_stand,distance=..1] weapon.mainhand from entity @s hotbar.8

execute store result score #select temp run data get entity @n[tag=tempSS,distance=..1,type=armor_stand] HandItems[0].components."minecraft:custom_data".select_arrow
$execute store result entity @n[tag=tempSS,distance=..1,type=armor_stand] HandItems[0].components."minecraft:custom_data".select_arrow int 1 run scoreboard players set #select temp $(index)

item replace entity @s hotbar.8 from entity @n[tag=tempSS,distance=..1,type=armor_stand] weapon.mainhand

kill @n[tag=tempSS,distance=..1,type=armor_stand]
scoreboard players reset #select temp

function dab:system/arrow_bundle/storage/update

playsound item.bundle.insert player @a ~ ~ ~ 1.0 1.0